
import { request } from "../../request/index"
import { showModal,chooseAddress,showToast,Login } from "../../utils/tools"
import regeneratorRuntime, { awrap } from '../../lib/runtime/runtime';
 
Page({

  /**
   * 页面的初始数据
   */
  data: { 
  },
 
  // 授权
  async handGetUserInfo(e){  
    let { iv,rawData,encryptedData,signature } = e.detail 
    let  { code } = await Login() 
    // 接口所需数据
    let orderParams = { iv,rawData,encryptedData,signature,code } 
    const res = await request({ url:"/users/wxlogin",data:orderParams,method:"post" }) 
    if(res == null){
      await showToast({ title:"数据为空",duration:1000,icon:"none"})   
      wx.switchTab({
        url: '/pages/user/index',
      })
    }
  },
 
})